package pl.edu.pjwstk.kor.sbql4j.dev;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.db4o.ObjectContainer;
import com.db4o.ext.Db4oDatabase;
import pl.edu.pjwstk.kor.database.Database;
import pl.edu.pjwstk.kor.database.Sbql4jQuery;
import pl.edu.pjwstk.kor.model.Customer;
import pl.edu.pjwstk.kor.model.Deal;
import pl.edu.pjwstk.kor.model.Employee;
import pl.edu.pjwstk.kor.model.Service;

public class DevQuery implements Sbql4jQuery {
    
    public DevQuery() {
        super();
    }
    private Database database;
    
    @Override()
    public void setDatabase(Database db) {
        this.database = db;
    }
    
    public List<Employee> getAllEmployees() {
        ObjectContainer db = database.getObjectContainer();
        Object res = new DevQuery_SbqlQuery0(db).executeQuery();
        Collection<pl.edu.pjwstk.kor.model.Employee> emps = (Collection)res;
        return new ArrayList(emps);
    }
    
    public List<Customer> getAllCustomers() {
        ObjectContainer db = database.getObjectContainer();
        Object r = new DevQuery_SbqlQuery1(db).executeQuery();
        Collection<pl.edu.pjwstk.kor.model.Customer> c = (Collection)r;
        return new ArrayList(c);
    }
    
    public List<Service> getAllServices() {
        ObjectContainer db = database.getObjectContainer();
        Object s = new DevQuery_SbqlQuery2(db).executeQuery();
        Collection<pl.edu.pjwstk.kor.model.Service> c = (Collection)s;
        return new ArrayList(c);
    }
    
    public List<Deal> getAllDeals() {
        ObjectContainer db = database.getObjectContainer();
        Object d = new DevQuery_SbqlQuery3(db).executeQuery();
        Collection<pl.edu.pjwstk.kor.model.Deal> c = (Collection)d;
        return new ArrayList(c);
    }
}